﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Logic;
using Entities;

namespace Presentation
{
    public partial class AdvancedSettings : UserControl
    {
        public AdvancedSettings()
        {
            InitializeComponent();
        }

        public void SetProperties()
        {
            Logic.Properties.Settings.Default.PlayerPath = textBoxPlayerPath.Text.Trim();
            //Logic.Properties.Settings.Default.InfoProvider = (InfoProvider)Enum.Parse(typeof(InfoProvider), comboBoxInfoProvider.SelectedItem.ToString(), true);
            Logic.Properties.Settings.Default.SeekOriginalName = checkBoxSeekOriginalMovieTitle.Checked;
            Logic.Properties.Settings.Default.DeletePostersAtClose = checkBoxDeletePosters.Checked;
        }

        private void AdvancedSettings_Load(object sender, EventArgs e)
        {
            textBoxPlayerPath.Text = Logic.Properties.Settings.Default.PlayerPath;
            //comboBoxInfoProvider.SelectedItem = Enum.GetName(typeof(InfoProvider), Logic.Properties.Settings.Default.InfoProvider);
            //comboBoxInfoProvider.SelectedItem = Logic.Properties.Settings.Default.InfoProvider.ToString();
            checkBoxSeekOriginalMovieTitle.Checked = Logic.Properties.Settings.Default.SeekOriginalName;
            checkBoxDeletePosters.Checked = Logic.Properties.Settings.Default.DeletePostersAtClose;
        }

        private void buttonSelectPlayer_Click(object sender, EventArgs e)
        {
            if (openFileDialogSelectPlayerPath.ShowDialog() == DialogResult.OK && openFileDialogSelectPlayerPath.FileName != "")
            {
                if (openFileDialogSelectPlayerPath.FileName.Contains(".exe"))
                    textBoxPlayerPath.Text = openFileDialogSelectPlayerPath.FileName.Trim();
            }
        }
    }
}